<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 

<h:head></h:head> 
<body> 
	<p:panel header="Lista Inviti" style="text-align:center">  
		<h:panelGrid columns="1" style="width:100%">
			<p:dataTable var="i" value="#{customerFrontend.inviteList}">    
		  
		        <p:column headerText="Invitato da">  
		            <h:outputText value="#{i.booking.user.email}" />  
		        </p:column> 
		        		  
		        <p:column headerText="Per">  
		            <h:outputText value="#{i.booking.packet.place.name}" />  
		        </p:column> 
		        		  
		        <p:column headerText="Dettagli">  
		            <ul>
		               	<ui:repeat value="#{i.booking.packet.products}" var="p">
		               	<li>
		               		<h:panelGroup layout="block"  rendered="#{p.excursion!=null}">
							    <b>Escursione:</b> 
							    #{p.excursion.name} 
				            	<h:outputText value="#{excursion.date}">
								    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
								</h:outputText>
								- 
								#{p.price} &euro;
			            	</h:panelGroup> 
			            	
			            	<h:panelGroup layout="block"  rendered="#{p.hotel!=null}">
							    <b>Hotel:</b> 
							    #{p.hotel.name} (#{p.hotel.stars} stelle) - 
							    dal
				            	<h:outputText value="#{p.hotel.checkInDate}">
								    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
								</h:outputText>
								al
				            	<h:outputText value="#{p.hotel.checkOutDate}">
								    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
								</h:outputText>
								- 
								#{p.price} &euro;
			            	</h:panelGroup> 
			            	
			            	<h:panelGroup layout="block"  rendered="#{p.flight!=null}">
							    <b>Volo:</b> 
							    Da 
				                #{p.flight.place.name} - 
				            	<h:outputText value="#{p.flight.departureDate}">
								    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
								</h:outputText>
				                 
								a
				                #{p.place.name} - 
				            	<h:outputText value="#{p.flight.arrivalDate}">
								    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
								</h:outputText>
								-
								#{p.price} &euro;
			            	</h:panelGroup> 
		               	</li>
		               	</ui:repeat>
		        	</ul>
		        </p:column> 
		        		  
		        <p:column headerText="Prezzo">  
		            <h:outputText value="#{i.booking.packet.price}" />  
		        </p:column> 
		        
		        <p:column headerText="Azioni">
		        	<h:form>
		        		<h:commandButton value="accetta" action="#{customerFrontend.acceptInvite(i)}"/>
		        	</h:form>
		        </p:column>
		    </p:dataTable>
		</h:panelGrid>
	</p:panel>  
			            
</body> 
</html>
